local kangrui = fk.CreateSkill{
  name = "bd__kangrui",
  tags = {
    Skill.Compulsory
  }
}
Fk:loadTranslationTable{
  ["bd__kangrui"] = "亢锐",
  [":bd__kangrui"] = "锁定技，你于回合内首次响应牌时弃一张牌，第二次响应时回复1点体力或摸两张牌。",
  ["#bd__kangrui_recover"] = "亢锐：回复1点体力或点击取消摸两张牌",
  ["#bd__kangrui_discard"] = "亢锐：弃置一张牌",
}

kangrui:addEffect(fk.CardRespondFinished, {
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(kangrui.name) and player == target
  end,
  on_use = function (self, event, target, player, data)
    local room = player.room
    local responds = room.logic:getEventsByRule(GameEvent.RespondCard, 2, function (e)
      return e.data.from == player
    end)
    if #responds == 0 and not player:isNude() then
      room:askToDiscard(player, {
        min_num = 1,
        max_num = 1,
        skill_name = kangrui.name,
        cancelable = false,
        prompt = "#bd__kangrui_discard"
      })
    elseif #responds == 1 then
      if player.hp < player.maxHp and room:askToSkillInvoke(player, {skill_name = kangrui.name, prompt = "#bd__kangrui_recover"}) then
        room:recover{
          who = player,
          num = 1,
          skillName = kangrui.name,
        }
      else
        room:drawCards(player, 2, kangrui.name)
      end
    end
  end
})

return kangrui